package previous.Test_0325;

import java.util.Scanner;

/**
 * Created with Intellij IDEA
 * Description:
 * User: 星辰
 */
public class Solution {
    //幸运数字
    //1.字符串转换
    public static void main1(String[] args) {
        //在此输入您的代码...

        int count=0;
        int i=1;
        while(true) {
            if(ha(i, 2)&&ha(i, 8)&&ha(i, 16)&& ha(i, 10)) {
                count++;
            }

            if(count==6) {
                System.out.println(i);
                return;
            }
            i++;
        }

    }
    //判断是否是幸运数字
    public static boolean ha(int n,int x) {
        //转为2.8.16进制
        String tmp=Integer.toString(n,x);
        int sum=0;
        for(int i=0;i<tmp.length();i++) {
            char c=tmp.charAt(i);
            if(c>='0' && c<='9') {
                sum+=c-'0';
            }else {
                sum+=c-'a'+10;
            }
        }
        return n%sum==0;
    }
    //矩形距面积
    //总面积=两个面积相加-重叠部分
    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int x1=scan.nextInt();
        int y1=scan.nextInt();
        int x2=scan.nextInt();
        int y2=scan.nextInt();
        int x3=scan.nextInt();
        int y3=scan.nextInt();
        int x4=scan.nextInt();
        int y4=scan.nextInt();
        long V1=(long)(Math.abs(x2-x1)*Math.abs(y2-y1));
        long V2=(long)(Math.abs(x4-x3)*Math.abs(y4-y3));
        int mx1=Math.max(x1, x3);
        int mx2=Math.min(x2, x4);
        int my1=Math.max(y1, y3);
        int my2=Math.min(y2, y4);
        long V3=(long)(Math.max(0,(mx2-mx1))*Math.max(0,(my2-my1)));
        long sum=V1+V2-V3;
        System.out.println(sum);
        scan.close();
    }

}
